function aOUT=EKF_v4(dg_a,do_a,sig_a,sio_a,dgo,doo,sigo,sioo,aIN,dg,do,sig,sio)
    num_a=size(dg_a);
    %初始化静态变量
    persistent P0;
    if isempty(P0)
            P0=1*eye(num_a(2));
    end
    if(doo<2)
        O_k=[dg_a;do_a;sig_a;sio_a];
%         odk=O_k*aIN';
        odk=[dg;do;sig;sio];
        R=0.01*eye(4);
        o_k=[dgo;doo;sigo;sioo];
    else
        O_k=[dg_a;sig_a];
%         odk=O_k*aIN';
        odk=[dg;sig];
        R=0.01*eye(2);
        o_k=[dgo;sigo];
    end
%     O_k=[dg_a;do_a;sig_a;sio_a];
%     odk=[dg;do;sig;sio];
%     R=40*eye(4);
%     o_k=[dgo;doo;sigo;sioo];
    e_k=o_k-odk;
    K_k=P0*O_k'/(R+O_k*P0*O_k');
    Q=0.1*eye(num_a(2));
    aUPDATE=aIN'-K_k*e_k;
    P0=Q+(eye(num_a(2))-K_k*O_k)*P0;
    aUPDATE=aUPDATE';
    aOUT=[aUPDATE(1:16);aUPDATE(17:32)];
end